package de.szut.entity;

import com.j256.ormlite.field.DataType;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import de.szut.impl.UpgradeAbilityDaoImpl;

import java.io.Serializable;

/**
 * Possible upgrades of a ability.
 * Created by dzebcuks on 19.08.13.
 */
@DatabaseTable(daoClass = UpgradeAbilityDaoImpl.class, tableName = "abilityUpgrade")
public class AbilityUpgrade extends Ability implements Serializable {

    /**
     * Rank-number of the base ability.
     */
    @DatabaseField
    private int rankNumber;

    /**
     * Required ability to skill, before this upgrade can be purchased.
     * TODO: this should be a foreign field, but there seems to be a problem with ORMLite and
     * inherited fields...
     */
    @DatabaseField(dataType = DataType.SERIALIZABLE)
    private Ability dependentAbility;

    public int getRankNumber() {
        return rankNumber;
    }

    public void setRankNumber(int rankNumber) {
        this.rankNumber = rankNumber;
    }

    public Ability getDependentAbility() {
        return dependentAbility;
    }

    public void setDependentAbility(Ability dependentAbility) {
        this.dependentAbility = dependentAbility;
    }

    public boolean isSkillable(){
        boolean skillable = false;
        if(this.getDependentAbility().isSkilled()){
            skillable = true;
        }
        return skillable;
    }
}
